<template>
  <div class="dog">
    <img src="https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23514.jpg" alt="">
  <p @click="changeColor" :style="{'background-color':color}">这是一只孤独的狗</p>
  </div>
</template>

<script>
export default {
  data(){
    return{
      a:0,
      b:0,
      c:0,
      color:'',
      
    }
  },
  methods:{
  changeColor(e){
    this.a=Math.floor(Math.random()*256)
    // console.log(this.a);
    this.b=Math.floor(Math.random()*256)
    this.c=Math.floor(Math.random()*256)
    this.color='rgb('+this.a+','+this.b+','+this.c+')'
  }
    }
  }

</script>

<style>
.dog{
  width: 300px;
  border: 1px solid black;
  text-align: center;
  float: left;
}
img{
  height: 200px;
  /* background-color: rgba(255,255,255,0); */
  
}



</style>